<?php

/**
 * @author thihien
 * @copyright 2011
 */

include_once('includes/general.php');
if(!tep_db_checkDb()) die('connect fail!');
$content='';
$sql='select * from tbl_tin_tuc';
$content.='<div id="content">
             <div class="tin_tuc_noi_bat">
                <div class="tieude" id="tieude_tintuc_noibat"><h3>Tin Tức</h3></div>';
    $kq=tep_db_query($sql);
    while($item=tep_db_fetch_array($kq)){
         $content.='
         <div class="hienthi_tt">
                <div class="hinh_anh_tin_tuc"><a href="?page=tintuc&matintuc='.$item['id'].'&mode=detail"><img  width="120" height="120" src="admin/upload/'.$item['hinh_anh'].'"/></a></div>
                <div class="tt_tintuc_tieude"><a  href="?page=tintuc&matintuc='.$item['id'].'&mode=detail"> '.$item['tieu_de'].'</a></div>
                <div class="mo_ta_ngan_gon_tin_tuc">'.$item['mo_ta_ngan_gon'].'<br/>
                    <a href="?page=tintuc&matintuc='.$item['id'].'&mode=detail"><p style="text-align: right; margin-right:10px">Chi Tiết...</p></a>
                </div>
           
        </div>';
   
    }
    $content.=' </div> </div>
    ';  
   
if(isset($_GET['mode']) && $_GET['mode']=='detail'){
    $matintuc=$_GET['matintuc'];
    $sql='select * from tbl_tin_tuc where id='.$matintuc;
    $kq=tep_db_query($sql);
    $item=tep_db_fetch_array($kq);
    
    $content='
        <div id="content">
       
            <div class="tin_tuc_noi_bat">
                <div class="tieude" id="tieude_tintuc_noibat"><h3>Tin tức</h3></div>
                <div class="hienthi_tt">
                    <div class="noidung_cb">'.$item['noi_dung'].'</div>
                </div>
                <div class="tincungchude"><p style="font-weight: bold; text-transform: capitalize; font-size: 13px; color: #0485eb;">Các Tin Tức Khác:</p></div>';
            
       $sql3='select * from tbl_tin_tuc where id!='.$matintuc;
       $kq3=tep_db_query($sql3);
       while($item1=tep_db_fetch_array($kq3)){
            $content.='<div class="tincungchude">
            <p style="margin-left:30px; text-transform: capitalize;  "><a style="text-decoration: none; " href="?page=tintuc&matintuc='.$item1['id'].'&mode=detail">'.$item1['tieu_de'].'</a><p></div>';
       }
        
   $content.='</div>
     </div>
    ';  
}

echo $content;


?>